<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Cache-control" content="max-age=0" />
		<meta http-equiv="Expires" content="0" />
		<meta http-equiv="Pragma" content="no-cache" />
		<script type="text/javascript" src="easyui/jquery.min.js"></script>
		<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="easyui/locale/easyui-lang-zh_CN.js" ></script>
		<script type="text/javascript" src="js/loading.js"></script>
		<script type="text/javascript" src="js/checkinFunction2.js"></script>
		<link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css"/>
		<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css" />
		<link rel="stylesheet" type="text/css" href="easyui/demo/demo.css"/>
		<link rel="stylesheet" type="text/css" href="easyui/themes/color.css" />
		<link rel="stylesheet" rev="stylesheet" href="css/style.css" type="text/css" media="all" />
	
		<title>登记案件</title>
		<script type="text/javascript">
		$(function(){
			//初始化 ready
			$('#student').hide();
			$('#teacher').hide();
			$('#reporterInfo').hide();
		});
		</script>
		<style>
			td ul{
				list-style-type:none;
				display: inline;
			}
			td ul li{
				float: left;
				width: 48.5%;
			}
		</style>
	</head>
	<body>
		<div id="buttonArea" style="width:100%">
			<table style="width:100%; border:0" cellpadding="0" cellspacing="0" class="CContent">
				<tr >
					<th style="width:100%" class="tablestyle_title" align="left"><img src="images/icon_1.png" height="28" width="45"/>添加事件</th>
				</tr>
				<tr>
					<td style="background-color:#ccc;line-height:20px;width:100%" id="tool">
						<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-save" plain="true" onclick="saveEvent()">保存事件</a>
						<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" plain="true" onclick="sendEmail()">发送邮件给报案人</a>
						<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" plain="true" onclick="sendSMS()">发送短信给负责人</a>
						<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" plain="true" onclick="uploadAudio()">上传录音</a>
						<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" plain="true" onclick="uploadImage()">上传图片</a>
						<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" plain="true" onclick="printEvent()">打印</a>
					</td>
				</tr>
				<tr>
					<td>
					<ul>
						<li>
							<fieldset style="height:98%;" >
								<legend>
									上传录音
								</legend>
								<div id="audioBox"></div>
								<form action="" id="audioForm" enctype="multipart/form-data" method="post">
									<input type="file" name="file" id="audioFile"/>
									<span id="uploadAudioLoading"></span>
									<input type="hidden" id="eventId2" name="eventId" value="" />
								</form>
							</fieldset>
						</li>
						<li>
								<fieldset style="height:98%;">
									<legend>
										上传图片
									</legend>
									<div id="imageBox"></div>
									<form action="" id="imageForm" enctype="multipart/form-data" method="post">
										<input type="file" name="file" id="imageFile"/>
										<span id="uploadImageLoading"></span>
										<input type="hidden" id="eventId3" name="eventId" value="" />
									</form>
								</fieldset>
						</li>
					</ul>
					
					</td>
				</tr>
			</table>
		</div><!--end of button Area !-->
		<div id="reporter">
		  <form id="reporterForm">
			<fieldset>
				<legend>报案人基本信息</legend>
				<table width="50%">
					<tr>
						<td width="20%"><span>与当事人关系</span></td>
						<td width="80%">
							<input id="relation" name="relation" class="easyui-combobox" style="width:36%"
							        required="true" data-options="url:'json/relation.json',
							                     method:'get',
							                     textField:'text',
							                     valueField:'value' "/>                  
						</td>
					</tr>
				</table>
				<div id="reporterInfo">
					<table width="100%">
						<tr>
							<td width="10%">报案人姓名</td>
							<td width="15%">
								<input id="reporterName" name="reporterName" class="easyui-textbox" required="true" style="width: 98%"/>
							</td>
							<td width="10%">报案人电话</td>
							<td width="15%">
								<input id="reporterPhone2" name="reporterPhone2" class="easyui-textbox" required="true" style="width:98%"/>
							</td>
							<td width="10%">报案人单位</td>
							<td width="15%">
								<input id="reporterOrganization" name="reporterOrganization" class="easyui-textbox" style="width:98%"/></td>
							<td width="10%">报案人住址</td>
							<td width="15%">
								<input id="reporterAddress" name="reporterAddress" class="easyui-textbox" style="width:98%"/>
							</td>
						</tr>
					</table>
				</div>
			</fieldset>
		  </form>
		</div><!--end of div reporter!-->
		<div id="victim">
		  <form id="victimForm">
			<fieldset>
				<legend>
					当事人基本信息
				</legend>
				<table width="50%">
					<tr>
						<td width="20%"><span>当事人类型</span></td>
						<td width="80%">
						<input class="easyui-combobox" id="victimType" name="victimeType" style="width:36%"
						       required="true" data-options="url:'json/victimType.json',
						                     method:'get',
						                     textField:'text',
						                     valueField:'value' " />
						</td>
					</tr>
				</table>
				<div id="student">
						<table>
							<tr>
								<td width="10%"><span>年级</span></td>
								<td width="15%">
								<input id="grade" name="grade" class="easyui-combobox" style="width:98%"
								        data-options="url:'json/grade.json',
								                      method:'get',
								                      textField:'text',
								                      valueField:'text' "/>
								</td>
								<td width="10%"><span>院系</span></td>
								<td width="15%">
									<input class="easyui-combobox" id="stud_academy" name="stud_academy" style="width:98%"
												data-options="url: 'Resource_departmentList',
															  method: 'get',
															  valueField: 'DEPARTMENTNAME',
															  textField: 'DEPARTMENTNAME' "/>
								</td>
								<td width="10%"><span>专业</span></td>
								<td width="15%">
									<input class="easyui-combobox" id="stud_major" name="stud_major"
									       style="width:98%" data-options="valueField:'MAJOR',textField:'MAJOR'"
									 />
								</td>
								<td width="10%"><span>班级</span></td>
								<td width="15%">
									<input class="easyui-combobox" id="className" name="className"
									       style="width:98%" data-options="valueField:'CLASSNAME',textField:'CLASSNAME'"
									      />
								</td>
							</tr><!--end of tr 1!-->
							<tr>
								<td width="10%">性别</td>
								<td>
									<input class="easyui-combobox" id="gender" name="gender" style="width:98%"
									       data-options="url:'json/gender.json',
									                     type:'get',
									                     valueField:'value',
									                     textField:'text'" />
								</td>
								<td width="10%">姓名</td>
								<td width="15%">
									<input class="easyui-combobox" id="stud_name" name="stud_name" style="width:98%" 
									       data-options="valueField:'STUDENTNAME',textField:'STUDENTNAME'"
									       />
								</td>
								<td width="10%">学号</td>
								<td width="15%">
									<input class="easyui-combobox" id="stud_id" name="stud_id" style="width:98%" 
									       data-options="valueField:'STUDENTID',textField:'STUDENTID'"
									       />
					
								</td>							
								<td width="10%"><span>宿舍号</span></td>
								<td width="15%">
									<input id="stu_room" name="stu_room" class="easyui-validatebox textbox" style="width:98%;height:22" />
								</td>
							</tr>
							<tr>
								<td width="10%"><span>报案人电话</span></td>
								<td width="15%">
									<input id="reporterPhone" name="reporterPhone" class="easyui-textbox" required="true" style="width:98%"/>
								</td>
								<td width="10%"><span>联系人电话</span></td>
								<td width="15%">
									<input id="contactPhone" name="contactPhone" class="easyui-textbox" required="true" style="width:98%"/>
								</td>
								<td width="10%"><span>班主任</span></td>
								<td width="15%">
									<input id="classMonitor" name="classMonitor" class="easyui-textbox"  readonly="true" style="width:98%" type="text"/>
								</td>
								<td width="10%"><span>辅导员</span></td>
								<td width="15%">
									<input id="classDirector" name="classDirector" class="easyui-textbox" readonly="true" style="width:98%" type="text"/>
								</td>
							</tr>
							<tr>
								<td width="10%"><span>辅导员电话</span></td>
								<td width="15%">
									<input id="directorPhoneNumber" name="directorPhoneNumber" class="easyui-textbox" readonly="true" style="width:98%" type="text"/>
								</td>
							</tr>
						</table>
				</div><!--end of student !-->
				<div id="teacher">
						<table width="100%">
							<tr>
								<td width="10%"><span>工作单位</span></td>
								<td width="15%">
									<input class="easyui-combobox" id="teac_academy" name="teac_academy" style="width:98%"
												data-options="url: 'Resource_departmentList',
															  method: 'get',
															  valueField: 'DEPARTMENTNAME',
															  textField: 'DEPARTMENTNAME' "/>
								</td>
								<td width="10%">报案人姓名</td>
								<td width="15%">
									<input class="easyui-combobox"  id="reporterTeacherName" name="reporterTeacherName" style="height:22;width:98%" 
									        data-options="textField:'EMPNAME',valueField:'EMPNAME'"/>
								</td>
								<td width="10%"><span>报案人电话</span></td>
								<td width="15%">
									<input id="reporterTeacherPhone" name="reportTeacherPhone" class="easyui-textbox" required="true"  style="width: 98%"/>
								</td>
								<td width="10%"><span>联系电话</span></td>
								<td width="15%">
									<input id="reporterTeacherContactPhone" name="reporterTeacherContactPhone" class="easyui-textbox" required="true" style="width:98%"/>
								</td>
							</tr><!--end of tr 1!-->
							<tr>
								<td width="10%" style="padding:0,5px"><span>宿舍楼</span></td>
								<td width="15%" style="padding:0,5px">
									<input id="teac_building" name="teac_building" class="easyui-validatebox textbox" style="width:98%;height:22"
									       />
								</td>
								<td width="10%" style="padding:0,5px"><span>房间号</span></td>
								<td width="15%" style="padding:0,5px">
									<input id="teac_room" name="teac_room" class="easyui-validatebox textbox" style="width:98%;height:22"
									  />
								</td>
								<td width="10%" style="padding:0,5px"><span>部门领导</span></td>
								<td width="15%" style="padding:0,5px">
									<input class="easyui-combobox" style="width:98%" id="departmentLeader" name="departmentLeader" 
									       data-options="valueField:'USERNAME',textField:'USERNAME'"/>
								</td>
								<td width="10%"><span>领导电话</span></td>
								<td width="15%">
									<input class="easyui-textbox" required="true" id="leaderPhoneNumber" name="leaderPhoneNumber" type="text" style="width:98%"/>	
								</td>
							</tr>
						</table>
				</div><!--end of div teacher!-->
			</fieldset>
		  </form>
		</div><!--end of div victim !-->
		<div id="event" width="100%">
		  <form id="eventForm">
			<fieldset>
				<legend>案件基本信息[案件号:<font color="red"><span id="eventId1"></span></font>]</legend>
					<table style="width: 100%">
						<tr>
							<td width="10%">案件类型</td>
							<td width="15%">
							<input class="easyui-combobox" id="eventType" name="eventType" style="width:100%"
							       data-options="url:'json/eventType.json', 
							                     method:'get',
							                     textField:'text',
							                     valueField:'text' "/>
							</td>
							<td width="10%">主管部门</td>
							<td width="15%">
								<input class="easyui-combobox" id="adminDepartment" name="adminDepartment" style="width:100%"
												data-options="url: 'Resource_departmentList',
															  method: 'get',
															  valueField: 'DEPARTMENTNAME',
															  textField: 'DEPARTMENTNAME'"/>
							</td>
							<td width="10%">主管领导</td>
							<td width="15%">
									<input class="easyui-combobox" id="adminDepartmentLeader" name="adminDepartmentLeader" style="width:100%"
											data-options="valueField: 'USERNAME',textField: 'USERNAME'"/>
							</td>
							<td width="10%" >主管部门领导电话</td>
							<td width="15%" >
								<input id="adminDepartmentLeaderPhone" name="adminDepartmentLeaderPhone" class="easyui-validatebox textbox" style="width:100%;height:22" />
							</td>

						</tr>
						<tr>
							<td width="10%" >协助部门</td>
							<td width="15%" >
								<input class="easyui-combobox" id="cooperateDepartment" name="cooperateDepartment" style="width:100%"
												data-options="url: 'Resource_departmentList',
															  method: 'get',
															  valueField: 'DEPARTMENTNAME',
															  textField: 'DEPARTMENTNAME'" />
							</td>
							<td width="10%">协管领导</td>
							<td width="15%">
								<input class="easyui-combobox" id="cooperateDepartmentLeader" name="cooperateDepartmentLeader" style="width:100%"
											data-options="valueField: 'USERNAME',textField: 'USERNAME'"/>
							<td width="10%">协管部门领导电话</td>
							<td width="15%">
								<input id="cooperateDepartmentLeaderPhone" name="cooperateDepartmentLeaderPhone" class="easyui-validatebox textbox" readonly="true" style="width:100%;height:22" />
							</td>
							<td width="10%">具体经办人</td>
							<td width="15%">
								<input class="easyui-validatebox textbox" id="executor" name="executor" style="width:100%;height:22" />
							</td>
						</tr>
						<tr>
							<td width="10%" >经办人电话</td>
							<td width="15%" >
								<input id="executorPhone" name="executorPhone" class="easyui-validatebox textbox" style="width:100%;height:22" />
							</td>
							<td width="10%">报案日期</td>
							<td width="15%">
								<input id="nowDate" name="eventDate" class="easyui-validatebox textbox"  style="width:100%;height:22" />
							</td>
							
						</tr>
						<tr>
							<td width="10%"><span>处理方式</span></td>
							<td width="15%"><input type="checkbox" id="smsInform" name="smsInform"/>短信通知</td>
							<td width="15%"><input type="checkbox" id="phoneInform" name="phoneInform"/>电话通知</td>
							
						</tr>
						<tr>
							<td width="10%">通知对象</td>
							<td width="10%"><input type="checkbox" id="informExecutor" name="informExecutor"/>具体经办人</td>
							<td width="10%"><input type="checkbox" id="informAdminDepartmentLeader" name="informAdminDepartmentLeader"/>主管领导</td>
							<td><input type="checkbox" id="informCooperate" name="informCooperate"/>协管领导</td>
							<td width="10%"><input type="checkbox" id="informClassDirector" name="informClassDirector"/>辅导员</td>
							<td width="*">其它人员
								<input id="informOthers" name="informOthers" class="easyui-validatebox textbox" style="width:98%;height:22" data-options="prompt:'请输入电话号码'"/>								
							</td>
							
						</tr>
						<tr>
							<td>案件描述</td>
							
						</tr>
					</table>
					<table width="100%" align="center">
						<tr>
					    	<td nowrap align="center">
					    	<textarea id="eventContent" name="eventContent" id="mainContent" cols="100" rows="15" style="background: url('images/icon_1.png') no-repeat bottom right;resize:none;"class="easyui-validatebox" required="true" missingMessage="请输入内容" placeholder="请输入事件内容"></textarea>
					    	</td>
						</tr>
					</table>
					<input type="hidden" id="eventId" name="eventId"/>
			</fieldset>
		  </form>
		</div><!--end of div event!-->
<div id="sendSMS" title="发短信给报案人" class="easyui-dialog" modal="true" style="width:400px;height:340px;padding:10px 20px"
            closed="true" buttons="#dlg-buttons">
	
     <form id="fm" method="post" novalidate>
 <!--   <div class="fitem">
       <label>收信人姓名:</label>
                <input name="name" class="easyui-validatebox" required="required" missingMessage="请输入收信人姓名"/>
            </div>
            <div class="fitem">
                <label>收信人手机号:</label>
                <input name="addr" class="easyui-numberbox" required="required" missingMessage="请输入收信人电话号码" invalidMessage="只能为数字"/>
            </div>
            <div class="fitem">
                <textarea name="text" class="easyui-validatebox" missingMessage="简单扼要简述一下事件内容"  rows="14" cols="36" required="true" placeholder="建议70字以内"></textarea>
            </div>
-->
			<table>
				<tr>
					<td>短信收信人</td>
				</tr>
				<tr>
					<td>
						<input id="smsname" name="name" class="easyui-validatebox textbox" style="width:80%;height:20"/>
					</td>
				</tr>
				<tr>
					<td>收信人电话号码</td>
				</tr>
				<tr>
					<td>
						<input id="smsaddr" name="addr" class="easyui-validatebox textbox" style="width:80%;height:20""/>
					</td>
				</tr>
				<tr>
					<td>短信内容</td>
				</tr>
				<tr>
					<td>
						<textarea id="smstext" name="text" class="easyui-validatebox textbox" cols="50" rows="10" >
						</textarea>
					</td>
				</tr>
			</table>
        </form>
</div>

<div id="audioPlayer" title="录音播放" class="easyui-dialog" modal="false" style="width:30%;height:80px;text-aling:center;background-color: black;"
            closed="true">
            <div style="pading:25px;" id="statrAudio"></div>
</div>
<div id="dlg-buttons">
        <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok"  style="width:90px" onclick="doSendSMS()">发送</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#sendSMS').dialog('close')" style="width:90px">取消</a>
</div>
	</body>
	<script type="text/javascript">
		$("#relation").combobox({
			onSelect : function() {
				var value = $(this).combobox('getValue');
				//alert(value);
				if (value == '本人' || value == '请选择---') {
					$("#reporterInfo").hide();
				} else {
					$("#reporterInfo").show();
				}
				$("#reporterForm").form('clear');
				$("#relation").combobox('setValue',value);
			}
		});

		$("#victimType").combobox({
			onSelect : function() {
				var value = $(this).combobox('getValue');
				//alert(value);
				if (value == "学生") {
					$("#student").show();
					$("#teacher").hide();
				} else if (value == '请选择--') {
					$("#student").hide();
					$("#teacher").hide();
				} else {
					$("#teacher").show();
					$("#student").hide();
				}
				$("#victimForm").form('clear');
				$("#victimType").combobox('setValue',value);
			}
		});
		
		$("#stud_academy").combobox({
			onSelect: function(){
				var stud_academy = $(this).combobox('getValue');
				$("#stud_major").combobox('reload','Resource_majorList?stud_academy='+stud_academy);
			}
		});
		
		$("#stud_major").combobox({
			onSelect:function(){
				var major = $(this).combobox('getValue');
				var grade = $("#grade").combobox('getValue');
				$("#className").combobox('reload','Resource_classNameList?grade=' 
						+ grade +'&major=' + major);
			}
		});
		
		$("#className").combobox({
			onSelect:function(){
				var className=$(this).combobox('getValue');
				//$("#stud_name").combobox('reload','Resource_studentNameList?className='+className);
				$.ajax({
					url:'Resource_classLeaderInfo',
					type:'POST',
					data:'className='+className,
					datatype:'json',
					success:function(data){
						//alert(JSON.stringify(data));
						//alert(data[0].CLASSMONITORNAME);
						$("#classMonitor").textbox('setValue',data[0].CLASSMONITORNAME);
						$("#classDirector").textbox('setValue',data[0].CLASSDIRECTORNAME);
						$("#directorPhoneNumber").textbox('setValue',data[0].CLASSDIRECTORPHONE);
					}
				});
			}
		});
		
		$("#gender").combobox({
			onSelect:function(){
				var gender=$(this).combobox('getValue');
				var className=$("#className").combobox('getValue');
				$("#stud_name").combobox('reload','Resource_studentNameList?className='+className+'&gender='+gender);
			}
		});
		
		$("#stud_name").combobox({
			onSelect:function(){
				var className=$("#className").combobox('getValue');
				var stud_name=$(this).combobox('getValue');
				$("#stud_id").combobox('reload','Resource_studentIdList?className='+className+'&stud_name='+stud_name);
			}
		});
		$("#stud_id").combobox({
			onSelect:function(){
				var stud_id=$(this).combobox('getValue');
				//alert(stud_id);
				$.ajax({
					url:'Resource_stuRoom',
					data:"stud_id="+stud_id,
					type:'post',
					dataType:'json',
					success:function(data){
						$("#stu_room").val(data[0].STUROOM);
					}
				});
			}
		});
		
		$("#teac_academy").combobox({
			onSelect:function(){
				var teac_academy=$(this).combobox('getValue');
				$("#reporterTeacherName").combobox('reload','Resource_getDepartmentEmp?teac_academy='+teac_academy);
				$("#departmentLeader").combobox('reload','Resource_departmentLeaderList?teac_academy='+teac_academy);
			}
		});
		
		$("#departmentLeader").combobox({
			onSelect:function(){
				var academy_leader=$(this).combobox('getValue');
				$.ajax({
					url:'Resource_leaderPhoneNumber',
					type:'Post',
					data:'academy_leader='+academy_leader,
					datatype:'json',
					success:function(data){
						//alert(JSON.stringify(data[0]));
						$("#leaderPhoneNumber").textbox('setValue',data[0].PHONE);
					}
				});
			}
		});
		
		$("#reporterTeacherName").combobox({
			onSelect:function(){
				var reporterTeacherName=$(this).combobox('getValue');
				$.ajax({
					url:'Resource_teacherBuilding',
					data:'reporterTeacherName='+reporterTeacherName,
					type:'post',
					dataType:'json',
					success:function(data){
						$("#teac_building").val(data[0].BUILDING);
					}
				});
				$.ajax({
					url:'Resource_teacherRoom',
					data:'reporterTeacherName='+reporterTeacherName,
					type:'post',
					dataType:'json',
					success:function(data){
						$("#teac_room").val(data[0].ROOM);
					}
				});
				//$("#teac_building").combobox('reload','Resource_teacherBuilding?reporterTeacherName='+reporterTeacherName);
				//$("#teac_room").combobox('reload','Resource_teacherRoom?reporterTeacherName='+reporterTeacherName);
			}
		});
					
		$("#adminDepartment").combobox({
			onSelect:function(){
				var teac_academy=$(this).combobox('getValue');
				$("#adminDepartmentLeader").combobox('reload','Resource_departmentLeaderList?teac_academy='+teac_academy);
			}
		});
		
		$("#adminDepartmentLeader").combobox({
			onSelect:function(){
				var academy_leader=$(this).combobox('getValue');
				$.ajax({
					url:'Resource_leaderPhoneNumber',
					type:'Post',
					data:'academy_leader='+academy_leader,
					datatype:'json',
					success:function(data){
						//alert(JSON.stringify(data[0]));
						$("#adminDepartmentLeaderPhone").val(data[0].PHONE);
									
					}
				});
			}
		});
		
		$("#cooperateDepartment").combobox({
			onSelect:function(){
				var teac_academy=$(this).combobox('getValue');
				$("#cooperateDepartmentLeader").combobox('reload','Resource_departmentLeaderList?teac_academy='+teac_academy);
			}
		});
		
		$("#cooperateDepartmentLeader").combobox({
			onSelect:function(){
				var academy_leader=$(this).combobox('getValue');
				$.ajax({
					url:'Resource_leaderPhoneNumber',
					type:'Post',
					data:'academy_leader='+academy_leader,
					datatype:'json',
					success:function(data){
						//alert(JSON.stringify(data[0]));
						$("#cooperateDepartmentLeaderPhone").val(data[0].PHONE);
									
					}
				});
			}
		});
				
	</script>
</html>